#include<stdio.h>
#include<stdlib.h>
#include"alloc.h"

int main(int argc, char *argv)
{	
	int n = N;
	int *arr = NULL;
	int elem;
	int del_elem;
	int index;
	arr = alloc(n);

	for(int i = 0; i < n; i++){
		arr[i] = 2 * i + 1;
		printf("%d ", arr[i]);
	}
	printf("\n");

	printf("请输入要插入的元素：");
	scanf("%d", &elem);
	add_element_sort(&arr, &n, elem);
	show_element(arr, n);

	printf("请输入要删除的元素：");
	scanf("%d", &del_elem);
	del_element(&arr, &n, del_elem);
	show_element(arr, n);
	//int index = find_elem(arr, n, 5);
	//printf("%d", index);
	printf("请输入要查找的元素：");
	scanf("%d", &elem);
	index = find_elem(arr, n, elem);
	if(index != -1){
		printf("%d\n", index);
	}else{
		printf("你过关！\n");
	}

	printf("请输入你要修改的元素 和 修改后的元素：");
	scanf("%d %d", &del_elem, &elem);
	update_date(arr, n, elem, del_elem);
	show_element(arr, n);
	free(arr);
	arr = NULL;
}
